/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.cloudgameapi.transform.v20200728;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.cloudgameapi.model.v20200728.GetGameCcuResponse;
import com.aliyuncs.cloudgameapi.model.v20200728.GetGameCcuResponse.DataListItem;
import com.aliyuncs.transform.UnmarshallerContext;


public class GetGameCcuResponseUnmarshaller {

	public static GetGameCcuResponse unmarshall(GetGameCcuResponse getGameCcuResponse, UnmarshallerContext _ctx) {
		
		getGameCcuResponse.setRequestId(_ctx.stringValue("GetGameCcuResponse.RequestId"));

		List<DataListItem> dataList = new ArrayList<DataListItem>();
		for (int i = 0; i < _ctx.lengthValue("GetGameCcuResponse.DataList.Length"); i++) {
			DataListItem dataListItem = new DataListItem();
			dataListItem.setCcu(_ctx.longValue("GetGameCcuResponse.DataList["+ i +"].Ccu"));
			dataListItem.setGameId(_ctx.stringValue("GetGameCcuResponse.DataList["+ i +"].GameId"));
			dataListItem.setRegionId(_ctx.stringValue("GetGameCcuResponse.DataList["+ i +"].RegionId"));

			dataList.add(dataListItem);
		}
		getGameCcuResponse.setDataList(dataList);
	 
	 	return getGameCcuResponse;
	}
}